<?php
/* SVN FILE: $Id: manage.php 255 2009-12-22 06:45:47Z supersmashbrothers $ */
/**
* ibMarket 2
* IP.Board 3.0
* Bank - Manage accounts
*
* @author $Author: supersmashbrothers $
* @copyright $Copyright$
* @version $Revision: 255 $
* @lastrevision $Date: 2009-12-22 06:45:47 +0000 (Tue, 22 Dec 2009) $
* @modifiedby $LastChangedBy: supersmashbrothers $
* @lastmodified $LastChangedDate: 2009-12-22 06:45:47 +0000 (Tue, 22 Dec 2009) $
* @filesource $URL: http://ipb-ibmarket.googlecode.com/svn/ibmarket2/trunk/admin/applications_addon/other/ibmarket/plugins/bank/publicAction/manage.php $
*/

class plugin_public_bank_manage extends marketPublicCommand
{
	/**
	 * Main class entry point
	 *
	 * @access	public
	 * @param	object		ipsRegistry reference
	 * @return	void		[Outputs to screen]
	 */
	public function doExecute( ipsRegistry $registry )
	{
		if(!marketRegistry::hasPluginPermission('use'))
		{
			$this->registry->getClass('output')->showError('no_permission');
		}
		
		$this->registry->getClass('class_localization')->loadLanguageFile( array( 'bank_bank' ) );
		
		$this->request['account_id'] = intval($this->request['account_id']);
		
		$accounts = array();
		$this->DB->build(array('select'=>'*','from'=>'market_bank_accounts','where'=>"a_mem_id=".$this->memberData['member_id']));
		$q = $this->DB->execute();
		while($account = $this->DB->fetch($q))
		{
			$accounts[] = $account;
		}
		
		$content = $this->registry->getClass('output')->getTemplate('ibm_plugin_bank')->manageBankAccounts($accounts);
		
		$template = $this->registry->getClass('output')->getTemplate('ibmarket')->ibmarketHTMLWrapper($content);
		
		$this->registry->getClass('output')->setTitle( $this->settings['market_name'] );
		$this->registry->getClass('output')->addContent( $template );
		
        $this->registry->getClass('output')->sendOutput();
	}
}